import useAppInfoBuilder, {AppInfo, AppInfoQuery} from "/@/api/admin/model/AppInfoModel";


const {
    appInfo,
    appInfoColumns,
    tableAppInfoData
} = useAppInfoBuilder();

/**
 * 应用管理
 */
export default function useAppInfoComposable() {

    /**
     * 加载数据
     */
    const loadTableData = (params: AppInfoQuery) => {
        let start = (params.page - 1) * params.limit;
        let endNum = start + params.limit;
        tableAppInfoData.total = 56;
        tableAppInfoData.rows = [];
        for (let i = start; i < endNum; i++) {
            tableAppInfoData.rows.push({
                id: `123456789${i + 1}`,
                appTitle: params.appTitle + `${i + 1}`,
                devLang: params.devLang + `${i + 1}`,
                phone: `0592-6081259${i + 1}`,
                time: `6:00 ~ 24:00`,
                isSupport: `${i % 2 === 0 ? '是' : '否'}`,
                image: `https://img2.baidu.com/it/u=417454395,2713356475&fm=253&fmt=auto?w=200&h=200`,
            })
        }
    }


    return {
        loadTableData,
        tableAppInfoData,
        appInfo,
        appInfoColumns,
    }

}